import request from '@/config/axios'

export interface AbnormalVO {
  abnormalName: string
  dictAbnormalStatus: number
  functionPageId: number
  functionPageName: string
  dictAbnormalType: number
  abnormalMessage: string
  noticeRole: string
  noticeUser: string
  creatorName: string
}

// 查询配置中心-异常管理-异常配置列表
export const getAbnormalPage = async (params) => {
  return await request.get({ url: `/config/abnormal/page`, params })
}

// 查询配置中心-异常管理-异常配置详情
export const getAbnormal = async (id: number) => {
  return await request.get({ url: `/config/abnormal/get?id=` + id })
}

// 新增配置中心-异常管理-异常配置
export const createAbnormal = async (data: AbnormalVO) => {
  return await request.post({ url: `/config/abnormal/create`, data })
}

// 修改配置中心-异常管理-异常配置
export const updateAbnormal = async (data: AbnormalVO) => {
  return await request.put({ url: `/config/abnormal/update`, data })
}

// 删除配置中心-异常管理-异常配置
export const deleteAbnormal = async (id: number) => {
  return await request.delete({ url: `/config/abnormal/delete?id=` + id })
}

// 导出配置中心-异常管理-异常配置 Excel
export const exportAbnormal = async (params) => {
  return await request.download({ url: `/config/abnormal/export-excel`, params })
}

//配置中心-异常管理-异常配置-功能页面菜单获取
export const getFunctionPageMenu = async(classC) => {
  return await request.get({ url: `/system/menu/listClass?classC=` + classC })
}
//配置中心-异常管理-异常配置-异常配置获取字段
export const getfield = async(id) => {
  return await request.get({ url: `/system/menu/listField?id=` + id })
}
//角色列表
export const getRoleList = async(name) => {
  return await request.get({ url: `/system/role/list-all-simple?name=`+name})
}
//用户列表
export const getUserList = async(userName) => {
  return await request.get({ url: `/system/user/list-all-simple-abnormal?userName=`+userName})
}